<?php

$mysqli = new mysqli("jmpmain.com", "jmpmain_tracker", "_", "jmpmain_servertracker");
if(mysqli_connect_errno()){
  die("Could not resolve mysql connection.");
}

header("Content-type: text/xml");
$result = $mysqli->query("delete from current where TIMESTAMPDIFF(MINUTE, pingtime, NOW()) > 5;");
$results = $mysqli->query("select * from current;");

if($results){
    echo "<?xml version=\"1.0\"?>\n";
    echo "<servers>\n";
    
    while($row = $results->fetch_object()){
        echo "<server ip=\"" . $row->ip . "\" port=\"" . $row->port . "\"/>\n";
    }
    
    echo "</servers>\n";
}
$mysqli->close();
?>